package com.byq.mm.smartlib.cluster.activity.client;

import com.byq.mm.abstractx.cluster.client.event.ClusterChangeEvent;
import com.byq.mm.application.cluster.client.SimpleSensorClient;
import com.byq.mm.smartlib.component.SensorView;
import com.byq.mm.smartlib.tools.IconManager;

import android.os.Bundle;
import android.view.MenuItem;


public  class ClientSimpleSensorActivity extends ClientClusterActivity<SimpleSensorClient> {

	private SensorView view;
	
	@Override
	public void onCreate(Bundle icicle) {
		super.onCreate(icicle);
		int dd = (int) client.getValue().getValue();
		String dn = client.getDevice().getName();
		if(dn == null){
			
	         String dct = client.getDevice().getType();
	         dn = IconManager.getString(this, dct);
		}
		
		 view = new SensorView(this,(int) client.getRange().getMax(), dd, (short)0, dn);
		 
		 setContentView(view);
	}

	MenuItem receive;
	MenuItem config;
	
   
   
	@Override
	protected void update(ClusterChangeEvent e) {
		int dd = (int) client.getValue().getValue();
		int max = (int) client.getRange().getMax();
		view.update(dd, max);
		
	}
}
